<template>
  <!-- 人工组卷 -->
    <el-dialog
    title="人工组卷试卷列表"
    :visible.sync="dialogVisible"
    width="1260px"
    :before-close="handleClose">
    <ul class="cade-bottom">
        <li v-for="item in tableData" :key="item.id" :class='tableData.length%3==0?"":"lis"' @click="openExam(item)">
            <p>{{item.title}}</p>
            <div class="spans">
                <span>合格标准:{{ inint.分值标准.及格 }}分及格(满分{{
                    Number(inint.试题分布.单选.总分) +
                    Number(inint.试题分布.多选.总分) +
                    Number(inint.试题分布.判断.总分)
                }}分)</span>
                <span>考试标准:{{ inint.考试时长.时长 }}分钟，{{
                Number(inint.试题分布.单选.数量) +
                Number(inint.试题分布.多选.数量) +
                Number(inint.试题分布.判断.数量)
              }}题</span>
            </div>
            <!-- <div style="width:100%;text-align:center;">
                <el-button  type="primary" size="medium" @click="open(item)">点击进入</el-button>
            </div> -->
        </li>
    </ul>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">关 闭</el-button>
  </span>
</el-dialog>
</template>

<script>
import {paperlist,zujuanstart,zujuanstartexam} from '@/api/admin.js'
import { getsubject_id, getsubjectTitle, getapplyid } from "@/utils/auth";
// /rengongm
export default {
    data() {
        return {
            dialogVisible:false,
            tableData:[],//试卷数据
            inint:{},
            applyid:'',
            daan:'',
        }
    },
    methods: {
        //打开模态框
        async open(data){
            const {applyid,name,obj,daan} = data
            this.dialogVisible=true
            this.inint=obj
            this.daan=daan
            this.applyid=applyid
            await paperlist({applyid:applyid,cate:name}).then(res=>{
                if(res.code==200){
                    this.tableData=res.data
                }
            })
        },
        handleClose(){
            this.dialogVisible=false
        },
        //打开考试页面
        openExam(data){
            if(data.cate=='模拟考试试卷'){
                zujuanstart({paperid:data.id,applyid:this.applyid}).then(res=>{
                if (res.code == 200) {
                    this.$store.commit("SET_TI", res.data.list);
                    this.$router.push(
                        "/rengongm?mockid=" +
                        res.data.mockid +
                        "&gz=" +
                        data.gz +
                        "&daan=" +
                        this.daan +
                        "&subjectid=" +
                        getsubject_id()
                    );
                }
            })
            }else{
                zujuanstartexam({paperid:data.id,applyid:this.applyid}).then(res=>{
                    if (res.code == 200) {
                        this.$store.commit("SET_TI", res.data.list);
                        this.$router.push(
                            "/simulationzsExam?examid=" +
                            res.data.examid +
                            "&gz=" +
                            data.gz +
                            "&daan=" +
                            this.daan +
                            "&subjectid=" +
                            getsubject_id()
                            +"&rengong=1"
                        );
                    }
                })
            }
        }
    },
}
</script>

<style lang="scss" scoped>
.cade-bottom{
        margin-top:45px;
        width: 100%;
        height: 545px;
        display: flex;
        flex-wrap: wrap;
        overflow:auto;
        // justify-content: space-between;
        &>li{
            height:224px;
            width:269px;
            border:1px #DDDDDD solid;
            margin-bottom:24px;
            margin-right:15px;
            padding:36px;
            border-radius: 5px;
            cursor: pointer;
            p{
                font-size: 1.125rem;
                width: 100%;
            }
            .spans{
                display: flex;
                flex-direction: column;
                padding:30px 0;
                span{
                    padding:10px 0;
                    font-size: 0.875rem;
                }
            }
            &:hover{
                background: hsl(0, 0%, 67%,0.1);
                // background-clip: 0.8;
            }
        }
        .lis{
            margin-right:30px;
        }
            
    }
</style>